import { createBrowserRouter } from "react-router-dom";
import App from "../App";

export const childrenRouter=[
    {
        path:'index',
        title:'首页',
        lazy:async()=>{
            const{default:Index}=await import('../pages/index/Index')
            return{
                element:<Index/>
            }
        }
    },
    {
        path:'message',
        title:'消息',
        lazy:async()=>{
            const{default:Message}=await import('../pages/message/Index')
            return{
                element:<Message/>
            }
        }
    }
]

const routes=createBrowserRouter([
    {
        path:'/',
        element:<App/>,
        children:childrenRouter
    },
    {
        path:'login',
        
        lazy:async()=>{
            const{default:Login}=await import('../pages/login/Index')
            return{
                element:<Login/>
            }
        }
    }
])
export default routes